package com.example.controller;

import com.example.common.Result;
import com.example.entity.Report;
import com.example.service.ReportService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Resource
    ReportService reportService;

    @PostMapping("/set")
    public Result set(@RequestBody Report report) {
        reportService.set(report);
        return Result.success("举报成功");
    }

    @GetMapping("/selectAll")
    public Result selectAll(Report report) {
        List<Report> list = reportService.selectAll(report);
        return Result.success("查询举报信息列表成功",list);
    }

    @GetMapping("/selectPage")
    public Result selectPage(Report report,
                             @RequestParam(defaultValue = "1") Integer pageNum,
                             @RequestParam(defaultValue = "10") Integer pageSize)
    {
        PageInfo<Report>list=reportService.selectPage(report,pageNum,pageSize);
        return Result.success("分页查询举报信息列表成功",list);
    }


}
